#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author : Tinfeng

import os
import sys
import HTMLTestRunner
import unittest
import threading
import multiprocessing
from business.LoginBusiness import LoginBusiness
from utils.FileRead import ReadYaml
from selenium import webdriver
import time

class ParameTestCase(unittest.TestCase):
    def __init__(self,methodName='runTest',parame=None):
            super(ParameTestCase,self).__init__(methodName)
            global parames
            parames = parame

class CaseTest(ParameTestCase):
    @classmethod
    def setUpClass(cls):
        print("setUpClasss---->"),parames

    def setUp(self):
        print("this is setup\n")

    def test_01(self):
        print("test case 里的参数"), parames
        login_business = LoginBusiness(parames)
        login_business.loginMethod()
        login_business.loansMethod()

    @unittest.skip("CaseTest")
    def test_02(self):
        print("this is case2\n")
        login_business = LoginBusiness(parames)
        login_business.loansMethod()

    def tearDown(self):
        print('this is teardown\n')

    @classmethod
    def tearDownClass(cls):
        print("this is class teardown\n")

def runMethod():
    suite = unittest.TestSuite()
    suite.addTest(CaseTest("test_01"))
    # suite.addTest(CaseTest("test_02"))

    timestr = time.strftime('%Y-%m-%d%H%M%S', time.localtime(time.time()))
    html_file = "..\\Report\\" + timestr + "ycbTestPms.html"
    fp = open(html_file, "wb")
    HTMLTestRunner.HTMLTestRunner(stream=fp).run(suite)

if __name__ == '__main__':
    runMethod()